home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright © 1991-1995 by TopSoft Inc. All rights reserved.
-
- You may distribute this file under the terms of the TopSoft
- Artistic License, accompanying this package.
-
- This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
- See the Modification History for more details.
-
- Product
- About Box
-
- FILE
- ABUEnvQD.c
-
- NAME
- ABUEnvQD.c, part of the ABox project source code,
- responsible for mix-in handling the AboutBox QD environment stuff.
-
- DESCRIPTION
- This file contains defines for the about box modules.
-
- DEVELOPED BY
- George (ty) Tempel netromancr@aol.com
- All code in this file, and its associated header file was
- Created by George (ty) Tempel in connection with the TopSoft, Inc.
- "FilterTop" application development, except where noted.
-
- CARETAKER - George (ty) Tempel <netromancr@aol.com>
- Please consult this person for any changes or suggestions to this file.
-
- MODIFICATION HISTORY
-
- dd mmm yy - xxx - patchxx: description of patch
- 12-aug-94 - ty - initial version created/released
- 10-mar-95 - ty - 1.2 addition of various static methods moved from
- ABObject; addition of method for examining
- the port, active screen, and pixel depth
- 23-may-95 - ty - changes for compatibility with the CodeWarrior CW6
- release and the associated Universal Headers from Apple:
- most methods that returned references now have "Ref" at
- the end of their methods names to prevent possible collisions
- with datatypes and classes of the same name (older versions
- of the compiler didn't have a problem with this).
-
- */
-
- /*===========================================================================*/
-
- /*======= Segmentation directives ========*/
-
- #ifdef USE_MANUAL_SEGMENTATION
- #pragma segment ty
- #endif
-
- /*============ Header files ==============*/
-
- #include "ABUEnvQD.h"
-
- /*=============== Globals ================*/
-
- /*================ CODE ==================*/
-
-
- /*=============================== ABUEnvQD::ABUEnvQD ================================*/
- ABUEnvQD::ABUEnvQD(void)
- {
- mVersion = 0;
- } // end ABUEnvQD
-
-
- /*=============================== ABUEnvQD::~ABUEnvQD ================================*/
- ABUEnvQD::~ABUEnvQD(void)
- {
- this->Close();
- } // end ~ABUEnvQD
-
-
-
- /*=============================== ABUEnvQD::IsPresent ================================*/
- Boolean ABUEnvQD::IsPresent(void)
- {
- if (this->WasntCheckedRef())
- {
- if (this->GestaltAvailable())
- {
- (void)this->CheckGestalt(gestaltQuickdrawVersion);
- this->SetVersion(this->GetResult());
-
- (void)this->CheckGestalt(gestaltQuickdrawFeatures);
- this->IndicatorRef() = true;
- } else {
- this->IndicatorRef() = false;
- } // end if else block
-
- this->CheckedRef() = true;
-
- } // end if block
- return this->IndicatorRef();
- } // end IsPresent
-
-
- /*=============================== ABUEnvQD::CheckVersion ================================*/
- long ABUEnvQD::CheckVersion(void)
- {
- if (this->WasntCheckedRef())
- (void)this->IsPresent();
-
- return this->VersionRef();
- } // end of CheckVersion
-
-
-
- /*=============================== ABUEnvQD::CheckFeatures ================================*/
- long ABUEnvQD::CheckFeatures(void)
- {
- if (this->WasntCheckedRef())
- (void)this->IsPresent();
-
- return this->ResultRef();
- } // end of CheckFeatures
-
-
-
- /*=============================== ABUEnvQD::HasColorQD ================================*/
- Boolean ABUEnvQD::HasColorQD(void)
- {
- return this->CheckVersion() >= gestalt8BitQD;
-
- } // end of HasColorQD
-
-
-
- /*=============================== ABUEnvQD::IsColorPort ==================================*/
- //
- // returns true if the current GrafPtr supports color qd
- //
- Boolean
- ABUEnvQD::IsColorPort(void) const
- {
- return ABUEnvQD::IsColorPort();
- GrafPtr curPort = NULL;
- ::GetPort(&curPort);
-
- return this->IsColorPort(curPort);
- }
-
-
-
- /*=============================== ABUEnvQD::IsColorPort ==================================*/
- //
- // returns true if the current GrafPtr supports color qd
- //
- Boolean
- ABUEnvQD::IsColorPort(void)
- {
- GrafPtr curPort = NULL;
- ::GetPort(&curPort);
-
- return ABUEnvQD::IsColorPort(curPort);
- }
-
-
-
- /*=============================== ABUEnvQD::IsColorPort ==================================*/
- //
- // returns true if the current GrafPtr supports color qd
- //
- Boolean
- ABUEnvQD::IsColorPort(GrafPtr inGrafPtr)
- {
- // Highest 2 bits of rowBytes are set for a Color GrafPort
- if (inGrafPtr != NULL)
- return ((inGrafPtr->portBits.rowBytes & 0xC000) == 0xC000);
- else
- return false;
- }
-
-
-
-
- /*=============================== ABUEnvQD::IsActiveScreenDevice ==================================*/
- //
- // returns true if the device is the active device
- //
- // is called by:
- // various
- //
- Boolean
- ABUEnvQD::IsActiveScreenDevice(GDHandle inGDevice)
- {
- if (inGDevice)
- return (::TestDeviceAttribute(inGDevice, screenDevice) &&
- ::TestDeviceAttribute(inGDevice, screenActive));
- else
- return false;
- }
-
-
-
- /*=============================== ABUEnvQD::GetPixelDepth ==================================*/
- //
- // GetPixelDepth will return the depth, in pixels, of the
- // given Graphics Device
- //
- short
- ABUEnvQD::GetPixelDepth(GDHandle inDevice)
- {
-
- // begin here...
-
- if (!inDevice)
- return kABdefaultScreenDepth;
-
- return (*(*inDevice)->gdPMap)->pixelSize;
-
- } // end of function GetPixelDepth()...
-
-
-